package com.zyt.springboot.paixu;

import java.util.Arrays;

/*
 * 腾哥专用代码防伪标志！！！
 * @params: 冒泡排序算法
 */
public class MaoPaoPaiXu {
    public static void main(String[] args) {
        /*
        冒泡排序：两个相邻的元素相比较
        */
        int[] ints = new int[]{9,8,3,4,5};
//        System.out.println(Arrays.toString(Arrays.stream(ints).sorted().toArray()));
        for(int i = 0;i< ints.length;i++){
            for (int j = 0;j< ints.length-1;j++){
                int temp = 0;
                if(ints[j]>ints[j+1]){
                    temp = ints[j+1];
                    ints[j+1] = ints[j];
                    ints[j] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(ints));
    }
}
